package com.itheima01;

import java.util.ArrayList;

public class ArraysListStudent {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();

        Student s = new Student("马冬梅", "女", 35);
        Student s1 = new Student("夏洛", "男", 18);
        Student s2 = new Student("秋雅", "女", 17);
        Student s3 = new Student("马西梅", "女", 34);

        list.add(s);
        list.add(s1);
        list.add(s2);
        list.add(s3);

        for (int i = 0; i < list.size(); i++) {
            //Student student = list.get(i);
            //String name = student.getName();
            String xing = list.get(i).getName().substring(0, 1);
            int age = list.get(i).getAge();
            if (xing.equals("马") && age > 30) {
                System.out.println(list.get(i));
            }
        }
    }
}
